﻿''' <summary>
''' Marks a method as a delegate Action(Of CommandLine) to be used as a console command, and specifies the help description and extended text, or if the command should be hidden.
''' </summary>
''' <remarks></remarks>
<AttributeUsage(AttributeTargets.Method)>
Public Class CommandMethodAttribute
    Inherits Attribute

    Private _AlternateNames() As String
    Public ReadOnly Property AlternateNames As String()
        Get
            Return _AlternateNames
        End Get
    End Property

    Private _Description As String
    Public ReadOnly Property Description As String
        Get
            Return _Description
        End Get
    End Property

    Private _FormattedHelpText As String
    Public ReadOnly Property FormattedHelpText As String
        Get
            Return _FormattedHelpText
        End Get
    End Property

    Private _IsHidden As Boolean
    Public ReadOnly Property IsHidden As Boolean
        Get
            Return _IsHidden
        End Get
    End Property

    Public Sub New()
        Me.New(False)
    End Sub

    Public Sub New(descriptionText As String)
        Me.New(descriptionText, String.Empty)
    End Sub

    Public Sub New(descriptionText As String, formattedHelp As String)
        Me.New(descriptionText, formattedHelp, False)
    End Sub

    Public Sub New(descriptionText As String, formattedHelp As String, ParamArray otherNames() As String)
        Me.New(descriptionText, formattedHelp, False, otherNames)
    End Sub

    Public Sub New(hidden As Boolean)
        Me.New(String.Empty, String.Empty, hidden)
    End Sub

    Public Sub New(descriptionText As String, formattedHelp As String, hidden As Boolean, ParamArray otherNames() As String)
        If descriptionText Is Nothing Then descriptionText = String.Empty
        If formattedHelp Is Nothing Then formattedHelp = String.Empty
        _Description = descriptionText
        _FormattedHelpText = formattedHelp
        _IsHidden = hidden
        _AlternateNames = otherNames
    End Sub
End Class
